home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / SUPERPD.PAK / PADFRAME.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  2KB  |  80 lines

  1. // padframe.cpp : implementation file
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "superpad.h"
  15. #include "padframe.h"
  16.  
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char BASED_CODE THIS_FILE[] = __FILE__;
  20. #endif
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CPadFrame
  24.  
  25. IMPLEMENT_DYNCREATE(CPadFrame, CMDIChildWnd)
  26.  
  27. int CPadFrame::m_nDefCmdShow = SW_SHOWMAXIMIZED;
  28. int CPadFrame::m_nDefCmdShowOld = SW_SHOWMAXIMIZED;
  29.  
  30. static TCHAR BASED_CODE szSec[] = _T("Settings");
  31. static TCHAR BASED_CODE szShowCmd[] = _T("ShowCmd");
  32.  
  33. void CPadFrame::ActivateFrame(int nCmdShow)
  34. {
  35.     if (nCmdShow == -1)
  36.         nCmdShow = m_nDefCmdShow;   // use our default
  37.     CMDIChildWnd::ActivateFrame(nCmdShow);
  38. }
  39.  
  40. void CPadFrame::Initialize()
  41. {
  42.     m_nDefCmdShow = AfxGetApp()->GetProfileInt(szSec, szShowCmd, m_nDefCmdShow);
  43.     m_nDefCmdShowOld = m_nDefCmdShow;
  44. }
  45.  
  46. void CPadFrame::Terminate()
  47. {
  48.     if (m_nDefCmdShow != m_nDefCmdShowOld)
  49.     {
  50.         AfxGetApp()->WriteProfileInt(szSec, szShowCmd, m_nDefCmdShow);
  51.         m_nDefCmdShowOld = m_nDefCmdShow;
  52.     }
  53. }
  54.  
  55. BEGIN_MESSAGE_MAP(CPadFrame, CMDIChildWnd)
  56.     //{{AFX_MSG_MAP(CPadFrame)
  57.     ON_WM_SIZE()
  58.     //}}AFX_MSG_MAP
  59. END_MESSAGE_MAP()
  60.  
  61. /////////////////////////////////////////////////////////////////////////////
  62. // CPadFrame message handlers
  63.  
  64. void CPadFrame::OnSize(UINT nType, int cx, int cy)
  65. {
  66.     CMDIChildWnd::OnSize(nType, cx, cy);
  67.     if (!IsWindowVisible())
  68.         return;
  69.  
  70.     switch (nType)
  71.     {
  72.     case SIZE_MAXIMIZED:
  73.         m_nDefCmdShow = SW_SHOWMAXIMIZED;
  74.         break;
  75.     case SIZE_RESTORED:
  76.         m_nDefCmdShow = SW_SHOWNORMAL;
  77.         break;
  78.     }
  79. }
  80.